package com.inspur.cloud.controller;

import com.inspur.cloud.entity.dataspace.common.OpEntityResult;
import com.inspur.cloud.service.dataspace.InfoService;
import com.inspur.cloud.service.dataspace.LoginService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/dataspace/api/v1/common")
@Api(value = "common", description = "获取通用信息")
public class CommonController {
    @Autowired
    private LoginService loginService;
    @Autowired
    private InfoService infoService;

    @GetMapping("/clusterName")
    @ApiOperation(value = "服务列表", notes = "对接人：soff")
    public OpEntityResult<String> clusterName() {
        OpEntityResult<String> result = new OpEntityResult();
        result.setData(infoService.getClusterName());
        result.setMsg("查询成功");
        result.setCode(1);
        return result;
    }

    @GetMapping("/services")
    @ApiOperation(value = "服务列表", notes = "对接人：soff")
    public OpEntityResult<List<String>> list() {
        OpEntityResult<List<String>> result = new OpEntityResult();
        result.setData(loginService.getServiceList());
        result.setMsg("查询成功");
        result.setCode(1);
        return result;
    }
}
